package com.ms;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;
import java.util.Map;

@RestController
@Slf4j
public class DemoController {

    @Autowired
    private Environment environment;

    @Autowired
    private DemoProperties demoProperties;

    @RequestMapping("/{key}")
    public String index(@PathVariable("key") String key) {
        log.info("{}", this.demoProperties);
        return this.environment.getProperty(key);
    }
}
